package com.zj.core.base

import android.app.Activity
import android.app.AlertDialog
import android.view.MotionEvent
import android.view.WindowManager
import com.zj.core.R

open class BaseDialog(context: Activity?): AlertDialog(context, R.style.Dialog_Common){
    override fun show(){
        super.show()
        window?.apply {
            clearFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE or WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM)
            setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE)
        }
    }

    /**
     * 通过该方法监听dialog是否被操作
     */
    override fun dispatchTouchEvent(ev: MotionEvent?): Boolean {
        return super.dispatchTouchEvent(ev)
    }
}